//    Openbravo POS is a point of sales application designed for touch screens.
//    Copyright (C) 2007-2009 Openbravo, S.L.
//    http://www.openbravo.com/product/pos
//
//    This file is part of Openbravo POS.
//
//    Openbravo POS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Openbravo POS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Openbravo POS.  If not, see <http://www.gnu.org/licenses/>.

package com.openbravo.pos.sales.shared;

import com.openbravo.bean.sales.SharedTicketInfo;
import com.openbravo.pos.base.AppView;
import java.util.*;
import javax.swing.*;
import com.openbravo.pos.payment.JPaymentKeyBoardSelectReceipt;
import com.openbravo.pos.payment.JPaymentKeyboardSelectRefund;
import com.openbravo.pos.payment.JPaymentSelect;
import com.openbravo.pos.sales.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class JTicketsBagKeyBoardShared extends JTicketsBagShared {

    /** Creates new form JTicketsBagShared */
    public JTicketsBagKeyBoardShared(AppView app, TicketsEditor panelticket) {

        super(app, panelticket);
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0);
        ActionListener actionListener = new ActionListener() {

         @Override
        public void actionPerformed(ActionEvent actionEvent) {
                m_jListTicketsActionPerformed(null);
           }
        };
        registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

        stroke = KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0);
        actionListener = new ActionListener() {

         @Override
        public void actionPerformed(ActionEvent actionEvent) {
                m_jDelTicketActionPerformed(null);
           }
        };
        registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

        stroke = KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0);
        actionListener = new ActionListener() {

         @Override
        public void actionPerformed(ActionEvent actionEvent) {
                m_jNewTicketActionPerformed(null);
           }
        };
        registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        
       /**由加、减号代替
        stroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.ALT_DOWN_MASK);
        actionListener = new ActionListener() {

         @Override
        public void actionPerformed(ActionEvent actionEvent) {
                showPrevTicket();
           }
        };
        registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

        stroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.ALT_DOWN_MASK);
        actionListener = new ActionListener() {

         @Override
        public void actionPerformed(ActionEvent actionEvent) {
                showNextTicket();
           }
        };
        registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        **/
    }

    @Override
    public JComponent getBagComponent() {
        return this;
    }
  
    
	@Override
	public JPaymentSelect getPaymentdialogreceipt() {
		return  JPaymentKeyBoardSelectReceipt.getDialog(this);
	}

	@Override
	public JPaymentSelect getPaymentdialogrefund() {
		return  JPaymentKeyboardSelectRefund.getDialog(this);
	}

	@Override
	protected String getSharedListOrderId(List<SharedTicketInfo> l) {
		JTicketsBagKeyBoardSharedList listDialog = JTicketsBagKeyBoardSharedList.newJDialog(JTicketsBagKeyBoardShared.this);
        return listDialog.showTicketsList(l);
	}

	
}
